package day06;

import java.util.Random;
import java.util.Scanner;

public class Homework1 {
    public static void main(String[] args) {
        //1
        /*
        int[] e=generateArray(5,100);
        for (int i = 0; i < e.length; i++) {
            System.out.println(e[i]);
        }*/
        //2
        /*
        double[]scores = inputData(6);
        double ave = totalAve(scores);
        System.out.println(ave);

         */
        //3
        Scanner scan= new Scanner(System.in);
        Random rand = new Random();
        int num = rand.nextInt(100+1);
        System.out.println("猜吧");
        while (true){
            int guess = scan.nextInt();
            if (guess>num){
                System.out.println("大了");
            } else if (guess<num) {
                System.out.println("小了");
            } else if (guess==num) {
                System.out.println("对了");
                break;
            }
        }

    }
    public static void say(){}
    public static void say(String name){}
    public static void say(String name,int age){}
    public static int sum(int num1,int num2){
        int num = num1+num2;
        return num;
    }
    public static int[] generateArray(int len,int max){
        Random rand = new Random();
        int[] arr = new int[len];
        for (int i=0;i<arr.length;i++){
            arr[i] = rand.nextInt(max+1);
        }
        return arr;
    }
    public static double[] inputData(int n){
        Scanner scan = new Scanner(System.in);
        double[] scores = new double[n];
        for (int i=0;i< scores.length;i++){
            System.out.println("请录入第"+(i+1)+"个评委的分数");
            scores[i] = scan.nextDouble();
        }
        return scores;
    }
    public static double totalAve(double[] scores){
        double total = 0;
        double max = scores[0];
        double min = scores[0];
        for (int i=0;i< scores.length;i++){
            total += scores[i];
            if (scores[i]>max){
                max = scores[i];
            }
            if (scores[i]<min) {
                min = scores[i];
            }
        }
        double avg = (total-max-min)/ (scores.length-2);
        return avg;
    }
}
